package cn.edu.sptc.sms_luojie.service.impl;
import cn.edu.sptc.sms_luojie.dao.MajorMapper;
import cn.edu.sptc.sms_luojie.entity.Major;
import cn.edu.sptc.sms_luojie.service.MajoyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MajorServicelmpl implements MajoyService{
   @Autowired
   private MajorMapper majorMapper;
    @Override
    public boolean insertMajor(Major major) {
        if(majorMapper.insert(major)>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean updateMajor(Major major) {
        if(majorMapper.update(major)>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean deleteMajor(Long id) {
        if(majorMapper.delete(id)>0){
            return true;
        }
        return false;
    }

    @Override
    public List<Major> queryByAll() {
      return majorMapper.selectAll();
    }

    @Override
    public Major queryByID(Long id) {
        return majorMapper.selectByID(id);
    }
}
